/*-------------------------------------------------------------------------------------------------------------------------------------------
Program: Main_v2.do
Task: Create all charts and figures in the main paper
project: Effect of Incentives on Motivated Numeracy amidst Covid-19
Mnemonic name: pol
Date created: 05/05/2022
Comments: This program creates all charts and figures shown in the main publication
--------------------------------------------------------------------------------------------------------------------------------------------*/
*version Stata/SE 17

clear all
set more off
macro drop _all

do pol_dir_v2  // !!!! establishes directories to store output. Look in this file first

macro list
capture log close
log using "${main_main}/mainreplication_v2.log", replace
use "${main_data}/pol_v0.8.dta", clear
***********************************************************************************************************************************************
***********************************************************************************************************************************************
***********************************************************************************************************************************************
*-------------------------------------------------------------------------------
* Table 2&3: The impact of incentives, numeracy and congeniality on accuracy
* Linear Probability model is used in these two tables
* Table 2 for unincentivized paticipants
* Table 3 for all participants
*-------------------------------------------------------------------------------
*-------------------------------------------------------------------------------
* Table 2: The impact of numeracy and congeniality on accuracy (unincentivized)
*-------------------------------------------------------------------------------
* Adjust the label values to accomodate the table
label var correct "Correct"
label var incentive "Incentive"
label var congenial "Congenial"
label var numeracy "Numeracy"
label var numsq "Numeracy$^2$"
label var num_con "Numeracy $\times$ Congenial"
label var in_num_con "Incentive $\times$ Numeracy $\times$ Congenial"
label var in_con "Incentive $\times$ Congenial"
label var in_num "Incentive $\times$ Numeracy"
label var in_numsq "Incentive $\times$ Numeracy$^2$"
label var in_numsq_con "Incentive $\times$ Numeracy$^2$ $\times$ Congenial"

* Equation 1 (without control variables) - Table 2 (1)
reg correct  congenial numeracy numsq if incentive==0, r
estadd local Controls "No"
est store a1

* Equation 1 (with control variables) - Table 2 (2)
reg correct  congenial numeracy numsq age i.gender i.race i.edu i.vote2016 if incentive==0, r
estadd local Controls "Yes"
est store a2

* Equation 2 (without control variables) - Table 2 (3)
reg correct  congenial numeracy numsq num_con c.numsq#c.congenial  if incentive==0, r
estadd local Controls "No"
est store a3

* Equation 2 (with control variables) - Table 2 (4)
reg correct congenial numeracy numsq num_con c.numsq#c.congenial age i.gender i.race i.edu i.vote2016 if incentive==0, r
estadd local Controls "Yes"
est store a4

* Export Table 2 in Latex
esttab  a1 a2 a3 a4 using "${main_main}/Table_2.tex" ,  ///
		nonumbers mtitles("(1)" "(2)" "(3)" "(4)") b(3) star(* 0.10 ** 0.05  *** 0.01) se(3)  label  ///
		replace 	///
		drop(age *gender* *race* *edu* *vote2016*) /// 
		scalars("Controls") ///
		tex addnotes("Note:Linear Probability Model with heterscedasticity robust standard errors." "Control variables in the regression are age, gender, race, education, and voting2016")
eststo clear
*-------------------------------------------------------------------------------
* Table 3: The impact of incentives, numeracy, and congeniality on accuracy (all participants)
*-------------------------------------------------------------------------------
* Equation 3 (without control variables) - Table 3 (5)
reg correct incentive, r
estadd local Controls "No"
est store a5

* Equation 3 (with control variables) - Table 3 (6)
reg correct incentive age i.gender i.race i.edu i.vote2016, r
estadd local Controls "Yes"
est store a6

* Equation 4 (without control variables) - Table 3 (7)
reg correct  congenial numeracy num_con numsq c.numsq#c.congenial incentive in_con in_num in_numsq in_num_con in_numsq_con, r
estadd local Controls "No"
est store a7

* Equation 4 (with control variables) - Table 3 (8)
reg correct  congenial numeracy num_con numsq c.numsq#c.congenial incentive in_con in_num in_numsq in_num_con in_numsq_con age i.gender i.race i.edu i.vote2016, r
estadd local Controls "Yes"
est store a8

* Export Table 3 in Latex
esttab  a5 a6 a7 a8 using "${main_main}/Table_3.tex" ,  ///
		nonumbers mtitles("(5)" "(6)" "(7)" "(8)" "(9)" "(10)") b(3) star(* 0.10 ** 0.05  *** 0.01) se(3)  label  ///
		replace 	///
		drop(age *gender* *race* *edu* *vote2016*) /// 
		scalars("Controls") ///
		tex addnotes("Note:Linear Probability Model with heterscedasticity robust standard errors." "Control variables in the regression are age, gender, race, education, and voting2016")					
eststo clear
***********************************************************************************************************************************************
***********************************************************************************************************************************************
***********************************************************************************************************************************************
*-------------------------------------------------------------------------------
* Figure 2: Predicted probabilities of correctly interpreting the data
*-------------------------------------------------------------------------------
* For this figure, we generate the density distribution by using MC simulation from logistic regresion to estimate equation 4
* The program "Clarify" is necessary to run this simulation.
* Please see "Clarify: Software for Interpreting and Presenting Statistical Results" (Tomz, Wittenberg, and King; 2001) for your reference.

* GRAPH1: TOP-LEFT Graph (Non-incentivized & Low numeracy)
* Graph below is the no-incentives low numeracy graph that will be in the top-left of the four graphs
* Low Numeracy, Incentive=0
* For the three simulations below: num is set at 1 out of 6 questions correctly solved, numeracy is set at -1.654, incentive =0

* Congenial = -1
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy -1.654 congenial -1 num_con 1.654 numsq 2.736 numsq_con -2.736 incentive 0 in_con 0 in_num 0 in_numsq 0 in_num_con 0 in_numsq_con 0
simqi, prval(1) genpr(p1)
drop b*

* Congenial = +1
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy -1.654 congenial 1 num_con -1.654 numsq 2.736 numsq_con 2.736 incentive 0 in_con 0 in_num 0 in_numsq 0 in_num_con 0 in_numsq_con 0
simqi, prval(1) genpr(p2)
drop b*

* Congenial = 0
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy -1.654 congenial 0 num_con 0 numsq 2.736 numsq_con 0 incentive 0 in_con 0 in_num 0 in_numsq 0 in_num_con 0 in_numsq_con 0
simqi, prval(1) genpr(p3)
drop b*

sum p1 p2 p3
*-------------------------------------------------------GRAPH1-----------------------------------------------------------------
graph twoway 	(kdensity p1, lcolor(orange) lwidth(medthick) text(10 0.33 "Congenial = -1", color (orange) size(small)))	///
				(kdensity p2, lcolor(green) lwidth(medthick) text(9 0.54 "Congenial = +1", color (green) size(small)))		/// 
				(kdensity p3, lcolor(gs5) lwidth(medthick) text(17 0.50 "Congenial = 0", color (gs5) size(small)))			///
				,legend(off)																								///
				ylabel("")																									///
				ytitle("Non-Incentivized", orientation(vertical) size(medium)) 												///
				xlabel(0.2 "20%" 0.3 "30%" 0.4 "40%" 0.5 "50%" 0.6 "60%") 													///
				xtitle("") 																									///
				title("Low numeracy", size (medium))																		///
				name(topleft1, replace) scheme(plotplain)
graph close
drop p1 p2 p3
*------------------------------------------------------------------------------------------------------------------------------
* GRAPH2: TOP-RIGHT Graph (Non-incentivized & High numeracy)
* Graph below is the no-incentives high numeracy graph that will be in the top-right of the four graphs
* High Numeracy, Incentive=0
* For the three simulations below: num=4.35 out 6 questions correctly solved, numeracy=+1.654, incentive =0

* Congenial = -1
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy 1.654 congenial -1 num_con -1.654 numsq 2.736 numsq_con -2.736 incentive 0 in_con 0 in_num 0 in_numsq 0 in_num_con 0 in_numsq_con 0
simqi, prval(1) genpr(p1)
drop b*

* Congenial = +1
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy 1.654 congenial 1 num_con 1.654 numsq 2.736 numsq_con 2.736 incentive 0 in_con 0 in_num 0 in_numsq 0 in_num_con 0 in_numsq_con 0
simqi, prval(1) genpr(p2)
drop b*

* Congenial = 0
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy 1.654 congenial 0 num_con 0 numsq 2.736 numsq_con 0 incentive 0 in_con 0 in_num 0 in_numsq 0 in_num_con 0 in_numsq_con 0
simqi, prval(1) genpr(p3)
drop b*

sum p1 p2 p3
*-------------------------------------------------------GRAPH2-----------------------------------------------------------------
graph twoway 	(kdensity p1, lcolor(orange) lwidth(medthick) text(9 0.26 "Congenial = -1", color (orange) size(small))) 	///
				(kdensity p2, lcolor(green) lwidth(medthick) text(13.5 0.52 "Congenial = +1", color (green) size(small)))	/// 
				(kdensity p3, lcolor(gs5) lwidth(medthick) text(17 0.47 "Congenial = 0", color (gs5) size(small)))			///
				,legend(off)																								///
				ylabel("")																									///
				ytitle("") 																									///
				xlabel(0.2 "20%" 0.3 "30%" 0.4 "40%" 0.5 "50%" 0.6 "60%") 													///
				xtitle("") 																									///
				title("High numeracy", size (medium))																		///
				name(topright1, replace) scheme(plotplain)
graph close
drop p1 p2 p3
*------------------------------------------------------------------------------------------------------------------------------
* GRAPH3: BOTTOM-LEFT Graph (Incentivized & Low numeracy)
* Graph below is the incentives low numeracy graph that will be in the bottom-left of the four graphs
* Low Numeracy, Incentive=1
* For the three simulations below: num=1 out 6 questions correctly solved, numeracy=-1.654, incentive =1

* Congenial = -1
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy -1.654 congenial -1 num_con 1.654 numsq 2.736 numsq_con -2.736 incentive 1 in_con -1 in_num -1.654 in_numsq 2.736 in_num_con 1.654 in_numsq_con -2.736
simqi, prval(1) genpr(p1)
drop b*

* Congenial = +1
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy -1.654 congenial 1 num_con -1.654 numsq 2.736 numsq_con 2.736 incentive 1 in_con 1 in_num -1.654 in_numsq 2.736 in_num_con -1.654 in_numsq_con 2.736
simqi, prval(1) genpr(p2)
drop b*

* Congenial = 0
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy -1.654 congenial 0 num_con 0 numsq 2.736 numsq_con 0 incentive 1 in_con 0 in_num -1.654 in_numsq 2.736 in_num_con 0 in_numsq_con 0
simqi, prval(1) genpr(p3)
drop b*

sum p1 p2 p3
*-------------------------------------------------------GRAPH3-----------------------------------------------------------------
graph twoway 	(kdensity p1, lcolor(orange) lwidth(medthick) text(12 0.49 "Congenial = -1", color (orange) size(small)))	///
				(kdensity p2, lcolor(green) lwidth(medthick) text(9 0.30 "Congenial = +1", color (green) size(small)))		/// 
				(kdensity p3, lcolor(gs5) lwidth(medthick) text(21 0.46 "Congenial = 0", color (gs5) size(small)))			///
				,legend(off)																								///
				ylabel("")																									///
				ytitle("  Incentivized  ", orientation(vertical) size(medium))												///
				xlabel(0.2 "20%" 0.3 "30%" 0.4 "40%" 0.5 "50%" 0.6 "60%") 													///
				xtitle("Probability of correct interpretation of data") 													///
				title("")																									///
				name(botleft1, replace) scheme(plotplain)
graph close
drop p1 p2 p3
*------------------------------------------------------------------------------------------------------------------------------
* GRAPH4: BOTTOM-RIGHT Graph (Incentivized & High numeracy)
* Graph below is the incentives high numeracy graph that will be in the bottom-right of the four graphs.*/
* High Numeracy, Incentive=1*/
* For the three simulations below: num=4.35 out 6 questions correctly solved, numeracy=1.654, incentive =1*/

* Congenial = -1
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy 1.654 congenial -1 num_con -1.654 numsq 2.736 numsq_con -2.736 incentive 1 in_con -1 in_num 1.654 in_numsq 2.736 in_num_con -1.654 in_numsq_con -2.736
simqi, prval(1) genpr(p1)
drop b*

* Congenial = +1
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy 1.654 congenial 1 num_con 1.654 numsq 2.736 numsq_con 2.736 incentive 1 in_con 1 in_num 1.654 in_numsq 2.736 in_num_con 1.654 in_numsq_con 2.736
simqi, prval(1) genpr(p2)
drop b*

* Congenial = 0
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy 1.654 congenial 0 num_con 0 numsq 2.736 numsq_con 0 incentive 1 in_con 0 in_num 1.654 in_numsq 2.736 in_num_con 0 in_numsq_con 0
simqi, prval(1) genpr(p3)
drop b*

sum p1 p2 p3
*-------------------------------------------------------GRAPH4-----------------------------------------------------------------
graph twoway 	(kdensity p1, lcolor(orange) lwidth(medthick) text(10 0.32 "Congenial = -1", color (orange) size(small)))	///
				(kdensity p2, lcolor(green) lwidth(medthick) text(19 0.54 "Congenial = +1", color (green) size(small)))		/// 
				(kdensity p3, lcolor(gs5) lwidth(medthick) text(23 0.51 "Congenial = 0", color (gs5) size(small)))			///
				,legend(off)																								///
				ylabel("")																									///
				ytitle("")																									///
				xlabel(0.2 "20%" 0.3 "30%" 0.4 "40%" 0.5 "50%" 0.6 "60%") 													///
				xtitle("Probability of correct interpretation of data") 													///
				title("")																									///
				name(botright1, replace) scheme(plotplain)
graph close
drop p1 p2 p3
*------------------------------------------------------------------------------------------------------------------------------
*----------------------------------------------------- GRAPH COMBINE-----------------------------------------------------------
graph combine topleft1 topright1 botleft1 botright1, scheme(plotplain)
graph export "${main_main}/Figure_2.png", replace
graph close
***********************************************************************************************************************************************
***********************************************************************************************************************************************
***********************************************************************************************************************************************
*----------------------------------------------------------------------------------------------------------------------------------
* Table 4: Differences in the predicted congeniality bias between less and more numerate individuals at various levels of numeracy
*----------------------------------------------------------------------------------------------------------------------------------
* For this table, we generate the probability density distribution of correct answers by using MC simulation from logistic regresion to estimate regression equation 4
* We set the high/low numeracy at +/-1SD, +/-1.5SD and +/-2SD
* We run the simulation similar to Figure 2. The difference in correct answers between Low and High Numeracy is tested using ttest.
* The standard deviation of the measure of numeracy is: 1SD = 1.654; 1.5SD = 2.481; 2SD = 3.308
* The formula used for standard deviation in t-test = S.E. * (sqrt(n)); where n = 1,000; n is the number of montecarlo simulations performed to generate the data.
********************************************************************************
* Model SD 1
********************************************************************************
* Simulation 1
* No incentive and Low numeracy
* Incentive = 0 and Numeracy = -1.654
* Congenial = -1 for conservative and Congenial = +1 for liberal
* We find the predicted differences in probability that partisans will correctly interpret the data
* Prob difference = Pr(correct=1|congenial=-1) - Pr(correct=1|congenial=+1)
set seed 2121985
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy -1.654 congenial 1 num_con -1.654 numsq 2.736 numsq_con 2.736 incentive 0 in_con 0 in_num 0 in_numsq 0 in_num_con 0 in_numsq_con 0
simqi, fd(prval(1)) changex(congenial 1  -1 num_con -1.654 1.654 numsq_con 2.736 -2.736) pr
drop b*
*-------------------------------------------------------------------------------
* Simulation 2
* No incentive and High numeracy
* Incentive = 0 and Numeracy = 1.654
* Congenial = -1 for conservative and Congenial = +1 for liberal
* We find the predicted differences in probability that partisans will correctly interpret the data
* Prob difference = Pr(correct=1|congenial=-1) - Pr(correct=1|congenial=+1)
set seed 2121985
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy 1.654 congenial 1 num_con 1.654 numsq 2.736 numsq_con 2.736 incentive 0 in_con 0 in_num 0 in_numsq 0 in_num_con 0 in_numsq_con 0
simqi, fd(prval(1)) changex(congenial 1  -1 num_con 1.654 -1.654 numsq_con 2.736 -2.736) pr
drop b*
*-------------------------------------------------------------------------------
* Simulation 3
* Incentive and Low numeracy
* Incentive = 1 and Numeracy= -1.654
* Congenial = +1 for conservative and Congenial = -1 for liberal
* We find the predicted differences in probability that partisans will correctly interpret the data
* Prob difference = Pr(correct=1|congenial=1) - Pr(correct=1|congenial=-1)
set seed 2121985
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy -1.654 congenial 1 num_con -1.654 numsq 2.736 numsq_con 2.736 incentive 1 in_con 1 in_num -1.654 in_numsq 2.736 in_num_con -1.654 in_numsq_con 2.736
simqi, fd(prval(1)) changex(congenial 1  -1 num_con -1.654 1.654 numsq_con 2.736 -2.736 in_con 1 -1 in_num_con -1.654 1.654 in_numsq_con 2.736 -2.736) pr
drop b*
*-------------------------------------------------------------------------------
* Simulation 4
* Incentive and High numeracy
* Incentive = 1 and Numeracy = 1.654
* Congenial = +1 for conservative and Congenial = -1 for liberal
* We find the predicted differences in probability that partisans will correctly interpret the data
* Prob difference = Pr(correct=1|congenial=1) - Pr(correct=1|congenial=-1)
set seed 2121985
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy 1.654 congenial 1 num_con 1.654 numsq 2.736 numsq_con 2.736 incentive 1 in_con 1 in_num 1.654 in_numsq 2.736 in_num_con 1.654 in_numsq_con 2.736
simqi, fd(prval(1)) changex(congenial 1  -1 num_con 1.654 -1.654 numsq_con 2.736 -2.736 in_con 1 -1 in_num_con 1.654 -1.654 in_numsq_con 2.736 -2.736) pr
drop b*
********************************************************************************
* Model SD 1.5
********************************************************************************
* Simulation 5
* No incentive and Low numeracy
* Incentive = 0 and Numeracy = -2.481 
* Congenial = -1 for conservative and Congenial = +1 for liberal
* We find the predicted differences in probability that partisans will correctly interpret the data
* Prob difference = Pr(correct=1|congenial=-1) - Pr(correct=1|congenial=+1)
set seed 2121985
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy -2.481 congenial 1 num_con -2.481 numsq 6.155 numsq_con 6.155 incentive 0 in_con 0 in_num 0 in_numsq 0 in_num_con 0 in_numsq_con 0
simqi, fd(prval(1)) changex(congenial 1  -1 num_con -2.481 2.481 numsq_con 6.155 -6.155) pr
drop b*
*-------------------------------------------------------------------------------
* Simulation 6
* No incentive and High numeracy
* Incentive = 0 and Numeracy = 2.481
* Congenial = -1 for conservative and Congenial = +1 for liberal
* We find the predicted differences in probability that partisans will correctly interpret the data
* Prob difference = Pr(correct=1|congenial=-1) - Pr(correct=1|congenial=+1)
set seed 2121985
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy 2.481 congenial 1 num_con 2.481 numsq 6.155 numsq_con 6.155 incentive 0 in_con 0 in_num 0 in_numsq 0 in_num_con 0 in_numsq_con 0
simqi, fd(prval(1)) changex(congenial 1  -1 num_con 2.481 -2.481 numsq_con 6.155 -6.155) pr
drop b*
*-------------------------------------------------------------------------------
* Simulation 7
* Incentive and Low numeracy
* Incentive = 1 and Numeracy= -2.481
* Congenial = +1 for conservative and Congenial = -1 for liberal
* We find the predicted differences in probability that partisans will correctly interpret the data
* Prob difference = Pr(correct=1|congenial=1) - Pr(correct=1|congenial=-1)
set seed 2121985
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy -2.481 congenial 1 num_con -2.481 numsq 6.155 numsq_con 6.155 incentive 1 in_con 1 in_num -2.481 in_numsq 6.155 in_num_con -2.481 in_numsq_con 6.155
simqi, fd(prval(1)) changex(congenial 1  -1 num_con -2.481 2.481 numsq_con 6.155 -6.155 in_con 1 -1 in_num_con -2.481 2.481 in_numsq_con 6.155 -6.155) pr
drop b*
*-------------------------------------------------------------------------------
* Simulation 8
* Incentive and High numeracy
* Incentive = 1 and Numeracy= 2.481
* Congenial = +1 for conservative and Congenial = -1 for liberal
* We find the predicted differences in probability that partisans will correctly interpret the data
* Prob difference = Pr(correct=1|congenial=1) - Pr(correct=1|congenial=-1)
set seed 2121985
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy 2.481 congenial 1 num_con 2.481 numsq 6.155 numsq_con 6.155 incentive 1 in_con 1 in_num 2.481 in_numsq 6.155 in_num_con 2.481 in_numsq_con 6.155
simqi, fd(prval(1)) changex(congenial 1  -1 num_con 2.481 -2.481 numsq_con 6.155 -6.155 in_con 1 -1 in_num_con 2.481 -2.481 in_numsq_con 6.155 -6.155) pr
drop b*
********************************************************************************
* Model SD 2
********************************************************************************
* Simulation 9
* No incentive and Low numeracy
* Incentive = 0 and Numeracy= -3.308
* Congenial = -1 for conservative and Congenial = +1 for liberal
* We find the predicted differences in probability that partisans will correctly interpret the data
* Prob difference = Pr(correct=1|congenial=-1) - Pr(correct=1|congenial=+1)
set seed 2121985
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy -3.308 congenial 1 num_con -3.308 numsq 10.943 numsq_con 10.943 incentive 0 in_con 0 in_num 0 in_numsq 0 in_num_con 0 in_numsq_con 0
simqi, fd(prval(1)) changex(congenial 1  -1 num_con -3.308 3.308 numsq_con 10.943 -10.943) pr
drop b*
*-------------------------------------------------------------------------------
* Simulation 10
* No incentive and High numeracy
* Incentive = 0 and Numeracy= 3.308
* Congenial = -1 for conservative and Congenial = +1 for liberal
* We find the predicted differences in probability that partisans will correctly interpret the data
* Prob difference = Pr(correct=1|congenial=-1) - Pr(correct=1|congenial=+1)
set seed 2121985
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy 3.308 congenial 1 num_con 3.308 numsq 10.943 numsq_con 10.943 incentive 0 in_con 0 in_num 0 in_numsq 0 in_num_con 0 in_numsq_con 0
simqi, fd(prval(1)) changex(congenial 1  -1 num_con 3.308 -3.308 numsq_con 10.943 -10.943) pr
drop b*
*-------------------------------------------------------------------------------
* Simulation 11
* Incentive and Low numeracy
* Incentive = 1 and Numeracy= -3.308 
* Congenial = +1 for conservative and Congenial = -1 for liberal
* We find the predicted differences in probability that partisans will correctly interpret the data
* Prob difference = Pr(correct=1|congenial=1) - Pr(correct=1|congenial=-1)
set seed 2121985
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy -3.308 congenial 1 num_con -3.308 numsq 10.943 numsq_con 10.943 incentive 1 in_con 1 in_num -3.308 in_numsq 10.943 in_num_con -3.308 in_numsq_con 10.943
simqi, fd(prval(1)) changex(congenial 1  -1 num_con -3.308 3.308 numsq_con 10.943 -10.943 in_con 1 -1 in_num_con -3.308 3.308 in_numsq_con 10.943 -10.943) pr
drop b*
*-------------------------------------------------------------------------------
* Simulation 12
* Incentive and High numeracy
* Incentive = 1 and Numeracy = 3.308
* Congenial = +1 for conservative and Congenial = -1 for liberal
* We find the predicted differences in probability that partisans will correctly interpret the data
* Prob difference = Pr(correct=1|congenial=1) - Pr(correct=1|congenial=-1)
set seed 2121985
estsimp logit correct numeracy congenial num_con numsq numsq_con incentive in_con in_num in_numsq in_num_con in_numsq_con, r
setx numeracy 3.308 congenial 1 num_con 3.308 numsq 10.943 numsq_con 10.943 incentive 1 in_con 1 in_num 3.308 in_numsq 10.943 in_num_con 3.308 in_numsq_con 10.943
simqi, fd(prval(1)) changex(congenial 1  -1 num_con 3.308 -3.308 numsq_con 10.943 -10.943 in_con 1 -1 in_num_con 3.308 -3.308 in_numsq_con 10.943 -10.943) pr
drop b*
*-------------------------------------------------------------------------------
*The difference in the probabilty of correct answers between Low and High Numeracy individuals is tested using a ttest. 
*The formula used for standard deviation in t-test = S.E. * (sqrt(n)); where n = 1,000; 
*n is the number of montecarlo simulations in each of the Simulations 1 through 12.
*-------------------------------------------------------------------------------

* Simulation1/2 SD = 1 No-incentive - Low vs High Numeracy
ttesti 1000 -.0352647 1.437752  1000 -.1517941 1.470209 

* Simulation3/4 SD = 1 Incentive - Low vs High Numeracy
ttesti 1000 .0106017 1.002676  1000 -.0912489  0.9939545 

* Simulation5/6 SD = 1.5 No-incentive - Low vs High Numeracy
ttesti 1000 .0196376 2.478625  1000 -.1566313 2.002857

* Simulation7/8 SD = 1.5 Incentive - Low vs High Numeracy
ttesti 1000 .0201847 1.702469  1000 -.1329161 1.336584

* Simulation9/10 SD = 2 No-incentive - Low vs High Numeracy
ttesti 1000 .0832507 4.145117  1000 -.1506497 3.231399

* Simulation11/12 SD = 2 Incentive - Low vs High Numeracy
ttesti 1000 .0237335 2.869283  1000 -.1788522 2.170208
***********************************************************************************************************************************************
***********************************************************************************************************************************************
***********************************************************************************************************************************************
drop _est*
log close
exit
